Skip to content

stream: validate writevSync chunks before queuing#64300

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-writev-sync-queues
Open

stream: validate writevSync chunks before queuing#64300
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-writev-sync-queues

Conversation

@trivikr

@trivikr trivikr commented Jul 5, 2026

Copy link
Copy Markdown
Member

Fixes: #64299

stream/iter now validates all writevSync() chunks before queueing a
batch. Previously, invalid chunks such as [1] could be queued first and
then throw from the queue’s byte-length accounting path, leaving invalid data
visible to the readable side.

This updates the shared chunk fast path to only skip conversion when every
entry is already a Uint8Array, and adds regression coverage that verifies
writevSync([1]) throws ERR_INVALID_ARG_TYPE without queueing data.


Assisted-by: openai:gpt-5.5

Ensure writevSync() validates every chunk before handing the batch to
the push queue. Invalid chunks now throw ERR_INVALID_ARG_TYPE without
leaving data readable from the failed write.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Jul 5, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 5, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter: writevSync queues invalid chunks before throwing

3 participants